﻿namespace zymain
{
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Runtime.CompilerServices;
    using System.Windows.Forms;
    using ToolUtil;
    using zyconfig;
    using zymain.Properties;

    public partial class UploadControl : UserControl
    {
        private string _FileName;
        public bool bolIsUp = false;
        private GroupBox groupBox1;
        public string guid = "";
        public string isFinlish = "";
        private Label label1;
        private Label label2;
        private Panel panel1;
        private Panel panel2;
        private Panel panel3;
        private PictureBox pictureBox1;
        private ProgressBar progressBar1;
        public string UpType = "";

        public event btnclick DeleteClick;

        public UploadControl()
        {
            this.InitializeComponent();
        }

        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (this.DeleteClick != null)
            {
                this.DeleteClick(sender, e);
            }
        }

        public void UploadFile()
        {
            this.pictureBox1.Image = Resources.control_play_blue;
            this.label1.Text = "上传文件名:" + this._FileName;
            FtpClientService service = new FtpClientService(DbConfig.FtpUser, DbConfig.FtpPass);
            Uri destinationPath = new Uri(DbConfig.FtpAddress + ":" + DbConfig.FtpPort);
            service.UploadFile(this._FileName, destinationPath, 0, "STOR", this.progressBar1);
            this.bolIsUp = true;
            this.isFinlish = "完成";
        }

        public string FileName
        {
            get
            {
                return this._FileName;
            }
            set
            {
                this._FileName = value;
                this.label1.Text = "上传文件名:" + this._FileName;
            }
        }

        public string UpState
        {
            get
            {
                return this.label2.Text;
            }
            set
            {
                this.label2.Text = value;
            }
        }

        public delegate void btnclick(object sender, EventArgs e);
    }
    }


